interface IResResult<IData> {
  data: IData,
  total: number
}
interface IUser {
  name: string,
  address: string,
  date: string
}
export const getUserList = (query: { name: string, index: number, size: number }): Promise<IResResult<IUser[]>> => {
  console.log('query', query)
  return new Promise((resolve, reject) => {
    const allList: IUser[] = [
      {
        date: '2016-05-03',
        name: '张三',
        address: '黑龙江',
      },
      {
        date: '2016-05-02',
        name: '李四',
        address: '辽宁',
      },
      {
        date: '2016-05-04',
        name: '王五',
        address: '吉林',
      },
      {
        date: '2016-05-01',
        name: '老六',
        address: '内蒙古',
      },
    ]
    const newList = allList.filter(item => item.name.includes(query.name || ''))
    setTimeout(() => {
      resolve({
        data: newList.slice(0, query.size),
        total: newList.length
      })
    }, 1500)
  })
}